import requests
import re

# pip install 模块名 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
# pip install requests -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
# pip install pdfplumber -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

# 升级pip:
# python -m pip install --upgrade pip


url = "http://www.weather.com.cn/weather1d/101210101.shtml"
resp = requests.get(url)
resp.encoding = 'utf-8'
print(resp.text)

city = re.findall('<span class="name">([\u4e00-\u9fa5]*)</span>', resp.text)
print(city)
weather = re.findall('<span class="weather">([\u4e00-\u9fa5]*)</span>', resp.text)
print(weather)
wd = re.findall('<span class="wd">(.*)</span>', resp.text)
print(wd)
zs = re.findall('<span class="zs">([\u4e00-\u9fa5]*)</span>', resp.text)
print(zs)

lst=[]
for a,b,c,d in zip(city, weather,wd, zs):
    lst.append([a,b,c,d])

print('*'*50)
print(lst)
print('-'*50)
for item in lst:
    print(item)

